import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        react(),
        createSvgIconsPlugin({
            iconDirs: [path.resolve(__dirname, 'src/icons')],
            symbolId: 'icon-[name]',
        }),
        // themePreprocessorPlugin({
        //     less: {
        //         arbitraryMode: true,
        //         defaultScopeName: "theme-default",
        //         defaultPrimaryColor: "#512da7",
        //         multipleScopeVars: [
        //             {
        //                 scopeName: 'theme-defult',
        //                 path: path.resolve('src/styles/theme/default.less')
        //             },
        //             {
        //                 scopeName: 'theme-light',
        //                 path: path.resolve('src/styles/theme/light.less')
        //             }
        //         ]
        //     }
        // })
    ],
    server: {
        port: 3033,
        open: true,
        host: '0.0.0.0',
        proxy: {
            '/ap': {
                target: 'http://36.26.76.196:29990',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, ""),
            }
        }
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, './src')
        }
    },
    css: {
        preprocessorOptions: {
            scss: {
                additionalData: `@import '@/styles/theme.scss';`
            },
            less: {
                javascriptEnabled: true,
                additionalData: `@import '@/styles/theme.less';`,
            }
        }
    }
})
